﻿using System.Windows;
using CrateMayhem.Common.Commanding;
using CrateMayhem.Common.Services;

namespace CrateMayhem.Desktop.ViewModel
{
    public class GameViewModel : CrateMayhem.Common.ViewModel.GameViewModel
    {
        private readonly IGameSettingsService gameSettingsService;

        public GameViewModel(IServiceFactory serviceFactory)
            : base(serviceFactory)
        {
            gameSettingsService = serviceFactory.Create<IGameSettingsService>();
            ResetLevelCommand = new DelegateCommand(ResetLevel);
        }

        public DelegateCommand ResetLevelCommand { get; private set; }

        public void ResetLevel()
        {
            const string message = "Are you sure you want to reset? This will delete all your level data.";

            if (MessageBox.Show(message, "Reset Levels", MessageBoxButton.YesNo) == MessageBoxResult.Yes) 
                gameSettingsService.ResetLevels();
        }
    }
}